/***************************************************************************
 *   Copyright (C) 2008 by Marco Gulino   *
 *   marco.gulino@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA            *
 ***************************************************************************/
#include "qdirinterfaceintegrationtest.h"
#include "qdirinterface.h"
#include "assertionUtils.h"
#include "fileutils.h"

void QDirInterfaceIntegrationTest::shouldReturnFilesMap()
{
    FileUtils::rmDir(WORKDIR);
    QDir workDir(WORKDIR);
    workDir.mkpath("1");
    workDir.mkpath("2");
    FileUtils::fileOf(1, WORKDIR + "/1kb" );
    FileUtils::fileOf(1, WORKDIR + "/1kb_bis" );
    FileUtils::fileOf(2, WORKDIR + "/2kb" );
    FileUtils::fileOf(2, WORKDIR + "/2/2kb" );
    FileUtils::fileOf(1, WORKDIR + "/1/1kb" );

    QDirInterface dir(WORKDIR);
    QFileInfoInterfaceHash *files=dir.findAllFiles();
    QCOMPARE2(files->count(), 5);
    QCOMPARE2(files->values(1024).size(), 3 );
    QCOMPARE2(files->values(2048).size(), 2 );
}
